#include "itoolwidget.h"
#include "ui_itooldialog.h"

#include "ioframeinterface.h"


IToolWidget::IToolWidget(IoEditFrameInterface* editWidget, QWidget *parent)
    : QDialog{parent}
    , ui(new Ui::IToolDialog)
{
    ui->setupUi(this);
    ui->vlayout_create->addWidget(editWidget);
    this->setWindowTitle(editWidget->title());
    connect(ui->pbtn_create_ok, &QPushButton::clicked, this, [editWidget, this](){
        editWidget->save();
        editWidget->setParent(nullptr);
        this->close();
    });
    connect(ui->pbtn_create_cancle, &QPushButton::clicked, this, [this, editWidget](){
        editWidget->setParent(nullptr);
        this->close();
    });
}

IToolWidget::~IToolWidget()
{
    delete ui;
}
